package com.byt.framlib.basemvp;

import android.content.Context;

import com.byt.framlib.basemvp.network.HttpManager;
import com.trello.rxlifecycle3.LifecycleProvider;
import com.trello.rxlifecycle3.components.support.RxAppCompatActivity;

import io.reactivex.ObservableTransformer;

/**
 * 类名称：  BasePresenter
 * 创建者：  钟文浩
 * 创建时间：2017/10/25
 * 邮箱：    m13421029930@163.com
 * 类描述：  Presenter基类
 */
public abstract class BasePresenter {

    protected Context mContext;
    protected HttpManager mManager;

    public BasePresenter(Context context) {
        this.mContext = context;
        this.mManager = new HttpManager();
    }

    protected <T> ObservableTransformer<T, T> getLifecycleProvider() {
        LifecycleProvider provider = null;
        if (null != mContext && mContext instanceof LifecycleProvider) {
            provider = (RxAppCompatActivity) mContext;
        }
        return provider.bindToLifecycle();
    }
}